package com.rural.bus.utils;

import android.app.Activity;
import android.content.Context;

import com.rural.bus.MainActivity;
import com.rural.bus.view.CommonAlertDialog;
import com.rural.bus.view.CommonAlertDialog.OnDialogDismissListener;

/***
 * call fail dialog
 * @author majie
 *
 */
public class CallFailDialog {
	
	public static void dialog(final Context context){
		CommonAlertDialog dialog = new CommonAlertDialog(context, "确定", "取消", "司机忙，无人应答，重新下单?", new OnDialogDismissListener() {

			@Override
			public void onConfirmClicked() {
				((Activity)context).finish();
			}

			@Override
			public void onCancelClicked() {
				ActivityControl control=ActivityControl.getInstance();
				Activity activity=control.getCurrentActivity();
				while(!(activity instanceof MainActivity)){
					activity.finish();
					control.removeActivity(activity);
				}
			}
		});
		dialog.show();
	}

}
